package com.hh.flow.service;

import com.hh.flow.domain.FlowDefinition;
import com.hh.flow.domain.FlowNode;
import com.hh.flow.domain.FlowSkip;
import com.hh.mybatis.service.IBaseService;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 流程定义Service接口
 *
 * @author hh
 * @date 2023-03-29
 */
public interface IFlowDefinitionService extends IBaseService<FlowDefinition> {
    List<FlowDefinition> queryByCodeList(List<String> flowCodeList);

    void closeFlowByCodeList(List<String> flowCodeList);

    /**
     * 查询流程节点列表
     * @param definitionId
     * @return
     */
    List<FlowNode> getNodeList(Long definitionId);

    /**
     * 保存流程结点
     * @param flowNodeList
     * @param definitionId
     */
    void saveNode(@RequestBody List<FlowNode> flowNodeList, Long definitionId);

    /**
     * 保存流程跳转
     * @param skipList
     * @param nodeId
     */
    void saveSkip(List<FlowSkip> skipList, Long nodeId);

    /**
     * 删除流程定义
     * @param ids
     */
    boolean remove(List<Long> ids);

    /**
     * 发布流程定义
     * @param id
     * @return
     */
    boolean publish(Long id);

    /**
     * 取消发布流程定义
     * @param id
     * @return
     */
    boolean unPublish(Long id);
}
